﻿<UserControl x:Class="RssReader.Silverlight.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid Margin="2" Background="LightBlue">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>
        <TextBlock Text="{Binding Title}" FontSize="26" Margin="3" Grid.Row="0"/>
        <StackPanel Orientation="Horizontal" Grid.Row="1">
            <ComboBox ItemsSource="{Binding Sources}" SelectedItem="{Binding Selected,Mode=TwoWay}" DisplayMemberPath="Name" Width="300" Margin="3"/>
            <Button Command="{Binding FetchCommand}" Content=" Read Blog " Margin="3"/>
        </StackPanel>
        <ScrollViewer Grid.Row="2" Background="White">
            <ItemsControl ItemsSource="{Binding Items}" Background="White">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Border BorderBrush="LightGray" Margin="5" CornerRadius="4" BorderThickness="2">
                            <StackPanel>
                                <TextBlock TextWrapping="Wrap" FontSize="16" Margin="3" Text="{Binding Header}"/>
                                <StackPanel Orientation="Horizontal" Margin="3">
                                    <TextBlock Text="Published:"/>
                                    <TextBlock Text="{Binding Published}"/>
                                </StackPanel>                                
                            </StackPanel>
                        </Border>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </ScrollViewer>


    </Grid>
</UserControl>
